<template>
  <div class="login-container">
    <h3>登录页面</h3>
    <input type="text" v-model="username" placeholder="账号" />
    <input type="password" v-model="password" placeholder="密码" />
    <button @click="login">登录</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // username: 'admin',
      // password: '123456',
      defaultUsername: 'admin',
      defaultPassword: '123456',
    };
  },
  methods: {
    login() {
      if (this.username === this.defaultUsername && this.password === this.defaultPassword) {
        alert('登录成功！');
        this.$router.push('/');
      } else {
        alert('账号或密码错误！');
      }
    },
  },
};
</script>